import http from "@/api";

import { ResPage } from "@/api/interface";
import { CommonTree, OptionVo } from "@/biz/interface";

import { JobTypeEntity, JobTypeVo } from "@/biz/interface/JobType";

import { ModuleMainUrl } from "..";

const moduleUrl = ModuleMainUrl;

// * 获取招工类型列表
export const getJobTypesVoListApi = (params: { type?: number }) => {
  return http.post<ResPage<JobTypeVo>>(moduleUrl + `/job/tpvolist`, params);
};

// * 获取招工类型列表
export const getJobTypesTreeApi = (params: {}) => {
  return http.post<CommonTree>(moduleUrl + `/job/tptree`, params);
};

// * 获取招工,兼职岗位 类型列表
export const getHtJobTypesTreeApi = (params: {}) => {
  return http.post<CommonTree>(moduleUrl + `/job/httptree`, params);
};

// * 获取招工,零时工岗位 类型列表
export const getOddJobTypesTreeApi = (params: {}) => {
  return http.post<CommonTree>(moduleUrl + `/job/ojttree`, params);
};

// * 新增招工类型接口
export const saveJobTypesApi = (jobTypes: JobTypeEntity) => {
  return http.post(moduleUrl + `/job/tpsave`, jobTypes);
};

// * 一级岗位类型下拉
export const getJobTypesL1DropApi = (params: { type?: number }) => {
  return http.post<ResPage<OptionVo>>(moduleUrl + `/job/tp1drop`, params);
};

// * 二级岗位类型下拉
export const getJobTypesL2DropApi = (params: {}) => {
  return http.post<ResPage<OptionVo>>(moduleUrl + `/job/tp2drop`, params);
};

// * 详情招工类型接口
export const getJobTypesInfoApi = (params: { id: string }) => {
  return http.post<JobTypeEntity>(moduleUrl + `/job/tpinfo`, params);
};

// * 删除招工类型接口
export const deleteJobTypesApi = (params: { id: string }) => {
  return http.post(moduleUrl + `/job/tpdelete`, params);
};

// * 修改招工类型状态接口
export const changeFlagActiveApi = (params: { id: string }) => {
  return http.post(moduleUrl + `/job/tpactive`, params);
};
